#include<iostream>
using namespace std;

int pan1(int i)
{
	if(i>=100&&i<=999)
	{
	int m=i;
		int sum=0;
		while(m)
		{
			sum=sum+(m%10)*(m%10)*(m%10);
			m=m/10;	
		}
		
		
	if(sum==i)
		return 1;
		else
			return 0;
		
	}
	
}

int main()
{
	int n,m;
	int total=0;
	cin>>n>>m;
	for(;n<=m;n++)
	{
		if(pan1(n)==1)
		{	cout<<n<<" ";
		total++;
		}
		
	}
	if(total==0)
		cout<<"NO";
	return 0;
}
